﻿using System;
using Downloader.Domain;
using Downloader.Framework.Queries;

namespace Downloader.Web.Controllers.ViewModels
{
    public class ArticleContentViewModel:IEntityConvert<ArticleContent>
    {
        public ArticleContentViewModel()
        {
            
        }

        public ArticleContentViewModel(ArticleContent article)
        {
            if(article==null)
                return;
            this.Id = article.Id;
            this.Title = article.Title;
            this.SubTitle = article.SubTitle;
            this.KeyWords = article.KeyWords;
            this.Introduction = article.Introduction;
            this.ContentText = article.ContentText;
            this.Category = article.Category.Id;
            this.CreateTime = article.CreateTime;
        }
        public  int Id { get; set; }
        /// <summary>
        /// 别名
        /// </summary>
        public string Url { get; set; }
        /// <summary>
        /// 文章标题
        /// </summary>
        public  string Title { get; set; }
        /// <summary>
        /// 文章副标题
        /// </summary>
        public  string SubTitle { get; set; }
        /// <summary>
        /// 文章关键字
        /// </summary>
        public  string KeyWords { get; set; }
        /// <summary>
        /// 文章分类
        /// </summary>
        public  int Category { get; set; }
        /// <summary>
        /// 版本信息
        /// </summary>
        public  string Version { get; set; }
        /// <summary>
        /// 附件大小
        /// </summary>
        public  float Size { get; set; }
        /// <summary>
        /// 文章介简
        /// </summary>
        public  string Introduction { get; set; }
        /// <summary>
        /// 文章内容
        /// </summary>
        public string ContentText { get; set; }
      
        /// <summary>
        /// 创建时间
        /// </summary>
        
        public  DateTime CreateTime { get; set; }
        /// <summary>
        /// 最后更新时间
        /// </summary>
        public  DateTime ModifyTime { get; set; }


        public void From(ArticleContent article)
        {
            if (article == null)
                return;
            this.Id = article.Id;
            this.Title = article.Title;
            this.SubTitle = article.SubTitle;
            this.KeyWords = article.KeyWords;
            this.Introduction = article.Introduction;
            this.ContentText = article.ContentText;
            this.Category = article.Category.Id;
            this.CreateTime = article.CreateTime;
        }
    }
}